package com.bst.config;

import com.bst.common.vo.ExcelExportVO;

import java.util.concurrent.LinkedBlockingQueue;

public enum DownloadManager {
    INSTANCE;

    private LinkedBlockingQueue<ExcelExportVO> downloadQueue;

    public LinkedBlockingQueue<ExcelExportVO> getDownloadQueue() {
        return downloadQueue;
    }

    private DownloadManager() {
        downloadQueue = new LinkedBlockingQueue<>();
    }

    /**
     *
     * @param request
     */
    public void addDownloadRequest(ExcelExportVO request) {
        downloadQueue.add(request);
    }

    public ExcelExportVO getNextDownloadRequest() throws InterruptedException {
        ExcelExportVO exportVO = downloadQueue.take();
        return exportVO;
    }

}